<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>03-do whild循环</title>
</head>

<body>
    <script>
        /* 
            do --- while
            语法结构：
                do {
                    逻辑体;
                }while(判断条件);
            执行顺序：
                1. 初始化变量
                2. 执行逻辑体
                3. 判断条件
                4.1  true 执行2.3.4步骤
                4.2  false 跳出代码块

            和while的区别在于，while语句是先判断再执行
            而do…while语句是先执行再判断
        */
        let i = 0;
        do {
            console.log('今晚吃鸡');
            i++;
        } while (i < 5);

        console.log('-----100 逢7过 7的倍数，个位是7，十位是7-----');

        let j = 1;
        do {
            if (j % 7 == 0 || j % 10 == 7 || parseInt(j / 10) == 7) {
                console.log('危险数是' + j);
            } else {
                console.log('安全数' + j);
            }
            j++;
        } while (j <= 100) {

        }

    </script>
</body>

</html>